import { App } from 'vue'
import { createRouter, createWebHashHistory } from 'vue-router'
import admin from './routes/admin'
import member from './routes/member'
import auth from './routes/auth'
import guard from './guard'

export const router = createRouter({
   history: createWebHashHistory(),
   routes: [
      {
         path: '/',
         name: 'main',
         component: () => import('@/views/home.vue')
      },
      ...admin,
      ...member,
      ...auth
   ]
})

export const setUpRouter = (app: App) => {
   guard(router)
   app.use(router)
}
